<?php
//跳转提示类
class Redirect {

    private static $instance = null;
    private $tpl = null;

    public static function getInstance(TPL &$tpl = null) {
        if(!self::$instance instanceof self) {
            self::$instance = new self();
            self::$instance->tpl = $tpl;
        }
        return self::$instance;
    }

    private function __construct() {}
    private function __clone() {}

    public function succ($url,$info = '') {
        if(!empty($info)) {
            $this->tpl->assign('message',$info);
            $this->tpl->assign('url',$url);
            $this->tpl->display(SMARTY_ADMIN.'public/succ.html');
        } else {
            header('Location:'.$url);
        }
        exit();
    }

    public function error($info) {
        $this->tpl->assign('message',$info);
        $this->tpl->assign('prev',Tool::getPrevPage());
        $this->tpl->display(SMARTY_ADMIN.'public/error.html');
        exit();
    }

}


?>